Make rtrim work sensibly when passed null pointers or pointers to empty
authorrobertl <robertl>
Tue, 3 Jun 2003 18:14:29 +0000 (18:14 +0000)
committerrobertl <robertl>
Tue, 3 Jun 2003 18:14:29 +0000 (18:14 +0000)
strings.

util.c

diff --git a/util.c b/util.c
index 52cfb4c19144f62ec1262cc6285bd501d858dd83..06656b4e0c3fea952e68e07a38980aadd416a2da 100644 (file)
--- a/util.c
+++ b/util.c
@@ -194,6 +194,10 @@ pstrdup(char *src)
 void 
 rtrim(char *s)
 {
+       if (!s || !*s) {
+               return;
+       }
+
        while (*s) {
                s++;
        }